<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script type="text/javascript">
function delArticle(articleId) {
	if (!confirm("删除操作不可恢复,是否继续？")) {
		return false;
	}
	
	window.location = "<%=basePath%>backend/article/del?articleId="+articleId;
}

</script>
<script type="text/javascript" src="<%=basePath%>js/filetypemg.js"></script>

<style>
.article-table tr{ height:40px; border-bottom:dotted 1px #D8D8D8; }
.article-table td{ border-right:dotted 1px #D8D8D8;}
.title_a{ display: block; width: 100%; height: 40px; line-height: 40px;}
a:hover {text-decoration: none;}
</style>
<div style="height:440px; overflow:hidden;">

<c:if test="${delSuccess==true }">
   <div class="ts">
	  <div><span style='color:'>删除成功</span></div>
	</div>
</c:if>
<c:if test="${delSuccess==false }">
   <div class="ts">
	  <div><span style='color:red'>删除失败</span></div>
	</div>
</c:if>

	<table class="article-table table-hover" style="width: 100%; height100%; text-align:centent; ; ">
        <c:choose>
			<c:when test="${empty acticleList}">
				<tr>
					<td colspan="3" style="color: red" align="center">没有可管理的文章或者文章数量为0</a></td>
				</tr>
			</c:when>
			<c:when test="${not empty acticleList}">
			    <tr align="center" bgcolor="#FFFFEC">
			       <td><strong>标题</strong></td>
			       <td width="20%"><strong>栏目</strong></td>
			       <td width="20%"><strong>时间</strong></td>
			       <td width="20%"><strong>操作</strong></td>
			    </tr>
				<c:forEach items="${acticleList }" var="article" varStatus="status">
					<tr class='discuss' align="center">
						<td align="left" style="overflow: hidden;">
						    	<a href='<%=basePath%>backend/article/detail/${article.id }' title='${article.title}' class=""
						    	 	target="_top" ><span >${article.title}</span></a>
						</td>
						<td title="${article.menuName }"><font color="#999"><span>${article.menuName }</span></font></td>
						<td align="center">
						    <font color="#999"><span>${article.simpleDate }</span></font>
					  	</td>
						<td align="center" class="content_td3">
						<a href='#'>
						<button style='width:60px;' class='btn btn-danger' onclick="return delArticle(${article.id })">删除</button>
						</a>
						<a href='<%=basePath%>backend/article/update/${article.id }' target="_top" style='width:60px;' class="update btn btn-warning">修改</a>
						</td>
				</c:forEach>
			</c:when>
		</c:choose>
	</table>
</div>

<div id="pageDir" style="width: 100%; margin:0 auto; text-align:center; margin-top:5px;">
<!--${paging.simplePaging }-->
	<c:if test="${paging.pageIndex > 1}">
		<a href="<%=basePath%>backend/article/list?p=1" target="iframe_article">首页</a>
		<a href="<%=basePath%>backend/article/list?p=${paging.preIndex }" target="iframe_article">上一页</a>
	</c:if>
	<c:if test="${paging.pageIndex <= 1}">
		<font color='#cccccc'>首页 上一页 </font>
	</c:if>
	
	<c:if test="${paging.pageIndex < paging.pageCount}">
	<a href="<%=basePath%>backend/article/list?p=${paging.nextIndex }" target="iframe_article">下一页</a>
	<a href="<%=basePath%>backend/article/list?p=${paging.pageCount }" target="iframe_article">末页</a>
	</c:if>
	<c:if test="${paging.pageIndex >= paging.pageCount}">
		<font color='#cccccc'>下一页 末页</font>
	</c:if>
	每页:${paging.size }/<span style="color:red">${paging.dateCount }</span>条  
	页数:<span style="color:blue">${paging.pageIndex }</span>/${paging.pageCount }页
</div>
